<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>两栏三栏布局</title>
    <style>
      .box {
        overflow: hidden;
      }
      .left {
        float: left;
        width: 200px;
        background-color: gray;
        height: 400px;
      }
      .right {
        margin-left: 210px;
        background-color: lightgray;
        height: 200px;
      }

      .wrap {
        background: #eee;
        overflow: hidden;
        padding: 20px;
        height: 200px;
        /* width: 200px; */
      }
      .left1 {
        width: 200px;
        height: 200px;
        float: left;
        background: coral;
      }
      .right1 {
        width: 120px;
        height: 200px;
        float: right;
        background: lightblue;
      }
      .middle {
        margin-left: 220px;
        height: 200px;
        background: lightpink;
        margin-right: 140px;
      }
    </style>
  </head>
  <body>
    <h1>两栏三栏布局</h1>
    <div class="box">
      <div class="left">左边</div>
      <div class="right">右边</div>
    </div>
    <h1>三栏布局</h1>
    <h2>浮动布局</h2>
    <div class="wrap">
      <div class="left1">左侧</div>
      <div class="right1">右侧</div>
      <div class="middle">中间</div>
    </div>

    <h2>两边float和负margin</h2>
    <style>
      .left2,
      .right,
      .main {
        height: 200px;
        line-height: 200px;
        text-align: center;
      }
      .main-wrapper {
        float: left;
        width: 100%;
      }
      .main {
        margin: 0 110px;
        background: black;
        color: white;
      }
      .left2,
      .right {
        float: left;
        width: 100px;
        margin-left: -100%;
        background: green;
      }
      .right {
        margin-left: -100px; /* 同⾃身宽度 */
      }
    </style>
    <div class="main-wrapper">
      <div class="main">中间⾃适应</div>
    </div>
    <div class="left2">左边固定宽度</div>
    <div class="right">右边固定宽度</div>
  </body>
</html>
